import React, { Component } from 'react'

class TodoItem extends Component {
  render() {
    return (
      <ul>
        {this.getList()}
      </ul>
    )
  }

  getList = () => {
    // const list = [ ...this.state.list ]

    return this.props.list.map((item, index) => {
      return <li key={index} onClick={(index) => this.props.del(index)}>{item}</li>
    })
  }
}

export default TodoItem
